
function noticeList(){
    $.get(
        CONTEXT_PATH + "/notice/list",
        function (data){
            data = $.parseJSON(data);
            console.log(data)
            if(data.code == 200){
                if(data.noticeUnreadCount != 0){
                    $("#noticeUnreadCount").text(data.noticeUnreadCount)
                }else {
                    $("#noticeUnreadCount").text('')
                }

                if(data.commentNotice.message == null ){
                    $("#commentNoticeMsg").hide()
                    $("#ifCommentDetailHref").hide()

                }else {
                    $("#commentSession").removeAttr("style")
                    if(data.commentNotice.unread != 0){
                        $("#commentNoticeUnread").text(data.commentNotice.unread)
                    }else {
                        $("#commentNoticeUnread").text('')
                    }

                   var commentNoticeMessageCreateTime = getMyDate(data.commentNotice.message.createTime)
                    $("#commentNoticeMessageCreateTime").text(commentNoticeMessageCreateTime)
                    $("#commentNoticeUserUsername").text(data.commentNotice.user.username)

                    var commentNoticeEntityType =  data.commentNotice.entityType==1?'帖子':'回复'
                    $("#commentNoticeEntityType").text(commentNoticeEntityType)
                    $("#commentNoticeCount").text(data.commentNotice.count)

                }


                if(data.likeNotice.message == null ){
                    $("#likeNoticeMsg").hide()
                    $("#ifLikeDetailHref").hide()

                }else {
                    $("#likeSession").removeAttr("style")
                    if(data.likeNotice.unread != 0){
                        $("#likeNoticeUnread").text(data.likeNotice.unread)
                    }else {
                        $("#likeNoticeUnread").text('')
                    }

                    var likeNoticeMessageCreateTime = getMyDate(data.likeNotice.message.createTime)
                    $("#likeNoticeMessageCreateTime").text(likeNoticeMessageCreateTime)
                    $("#likeNoticeUserUsername").text(data.likeNotice.user.username)

                    var likeNoticeEntityType =  data.likeNotice.entityType==1?'帖子':'回复'
                    $("#likeNoticeEntityType").text(likeNoticeEntityType)
                    $("#likeNoticeCount").text(data.likeNotice.count)

                }

                if(data.followNotice.message == null ){
                    $("#followNoticeMsg").hide()
                    $("#ifLikeDetailHref").hide()

                }else {
                    $("#followSession").removeAttr("style")
                    if(data.followNotice.unread != 0){
                        $("#followNoticeUnread").text(data.followNotice.unread)
                    }else {
                        $("#followNoticeUnread").text('')
                    }

                    var followNoticeCreateTime = getMyDate(data.followNotice.message.createTime)
                    $("#followNoticeCreateTime").text(followNoticeCreateTime)
                    $("#followNoticeUserUsername").text(data.followNotice.user.username)

                    $("#followNoticeCount").text(data.followNotice.count)

                }
            }
        }

    )
}


function getMyDate(str){
    var oDate = new Date(str),
        oYear = oDate.getFullYear(),
        oMonth = oDate.getMonth()+1,
        oDay = oDate.getDate(),
        oHour = oDate.getHours(),
        oMin = oDate.getMinutes(),
        oSen = oDate.getSeconds(),
        oTime = oYear +'-'+ getzf(oMonth) +'-'+ getzf(oDay) +' '+ getzf(oHour) +':'+ getzf(oMin) +':'+getzf(oSen);//最后拼接时间
    return oTime;
};
//补0操作
function getzf(num){
    if(parseInt(num) < 10){
        num = '0'+num;
    }
    return num;
}